﻿// HXSYDialog.cpp: 实现文件
//

#include "pch.h"
#include "幻想神域DLL.h"
#include "HXSYDialog.h"
#include "afxdialogex.h"


// HXSYDialog 对话框

IMPLEMENT_DYNAMIC(HXSYDialog, CDialogEx)

HXSYDialog::HXSYDialog(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG1, pParent)
{

}

HXSYDialog::~HXSYDialog()
{
}

void HXSYDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(HXSYDialog, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON2, &HXSYDialog::OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON1, &HXSYDialog::OnBnClickedButton1)
END_MESSAGE_MAP()


// HXSYDialog 消息处理程序
//[[[00D0DF1C + 1C]+ 28] + 00000288]

void HXSYDialog::OnBnClickedButton2()
{
	//静态加载
	// TODO: 在此添加控件通知处理程序代码
	//读内存,内存地址存储的是DWORD，需要转换成DWORD指针,如果想读浮点型就是*(FLOAT*)
	//任何偏移表达式，任何中间的是DWORD，最后一步，要读什么数据才有可能是DWORD和FLOAT
	//DWORD a = *(DWORD*)0x00D0DF1C;//a=[00D0DF1C]
	//a = *(DWORD*)(a + 0x1C);//a = [[00D0DF1C]+ 1C]
	//a = *(DWORD*)(a + 0x28);//a =[[[00D0DF1C]+1C]+28]
	//a = *(DWORD*)(a + 0x288);//a =[[[[00D0DF1C]+1C]+28]+288]
	
	//动态加载
	DWORD  B = (DWORD)GetModuleHandleA("ELEMENTCLIENT.EXE");
	DWORD a = *(DWORD*)(B+0x90DF1C);//a=[00D0DF1C] ;;;00D0DF1C =00400000(ELEMENTCLIENT.EXE)+0x90DF1C
	a = *(DWORD*)(a + 0x1C);//a = [[00D0DF1C]+ 1C]
	a = *(DWORD*)(a + 0x28);//a =[[[00D0DF1C]+1C]+28]
	a = *(DWORD*)(a + 0x288);//a =[[[[00D0DF1C]+1C]+28]+288]

}


void HXSYDialog::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	//写内存
	//静态加载
	//DWORD a = *(DWORD*)0x00D0DF1C;//a=[00D0DF1C]
	//a = *(DWORD*)(a + 0x1C);//a = [[00D0DF1C]+ 1C]
	//a = *(DWORD*)(a + 0x28);//a =[[[00D0DF1C]+1C]+28]
	//*(DWORD*)(a + 0x288) = 100;

	//动态加载
	DWORD  B = (DWORD)GetModuleHandleA("ELEMENTCLIENT.EXE");
	DWORD a = *(DWORD*)(B + 0x90DF1C);//a=[00D0DF1C] ;;;00D0DF1C =00400000(ELEMENTCLIENT.EXE)+0x90DF1C
	a = *(DWORD*)(a + 0x1C);//a = [[00D0DF1C]+ 1C]
	a = *(DWORD*)(a + 0x28);//a =[[[00D0DF1C]+1C]+28]
	*(DWORD*)(a + 0x288) = 100;
}
